package com.hundredapp.oa.domain;

import static javax.persistence.GenerationType.IDENTITY;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * OaRole entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "oa_role", catalog = "oa_demo")
public class OaRole implements java.io.Serializable {

	// Fields

	private Integer id;
	private String roleName;
	private Integer orderSeq;
	private Integer createUserId;
	private Timestamp createTime;
	private List<OaAction> oaActions = new ArrayList<OaAction>(0);
	private List<OaService> oaServices = new ArrayList<OaService>(0);

	// Constructors

	/** default constructor */
	public OaRole() {
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "role_name", length = 45)
	public String getRoleName() {
		return this.roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	@Column(name = "order_seq")
	public Integer getOrderSeq() {
		return this.orderSeq;
	}

	public void setOrderSeq(Integer orderSeq) {
		this.orderSeq = orderSeq;
	}

	@Column(name = "create_user_id")
	public Integer getCreateUserId() {
		return this.createUserId;
	}

	public void setCreateUserId(Integer createUserId) {
		this.createUserId = createUserId;
	}

	@Column(name = "create_time", length = 19)
	public Timestamp getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	@ManyToMany(cascade ={CascadeType.REFRESH,CascadeType.MERGE,CascadeType.PERSIST}, fetch = FetchType.LAZY)
	@JoinTable(name = "oa_role_action", catalog = "oa_demo", joinColumns = { @JoinColumn(name = "role_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "action_id", nullable = false, updatable = false) })
	public List<OaAction> getOaActions() {
		return this.oaActions;
	}

	public void setOaActions(List<OaAction> oaActions) {
		this.oaActions = oaActions;
	}

	@ManyToMany(cascade ={CascadeType.REFRESH,CascadeType.MERGE,CascadeType.PERSIST}, fetch = FetchType.LAZY)
	@JoinTable(name = "oa_role_service", catalog = "oa_demo", joinColumns = { @JoinColumn(name = "role_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "service_id", nullable = false, updatable = false) })
	public List<OaService> getOaServices() {
		return oaServices;
	}

	public void setOaServices(List<OaService> oaServices) {
		this.oaServices = oaServices;
	}

}